package com.aaa.dem1105.第二遍;

import java.util.stream.Stream;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/5  17:43
 */
public class Test {
    public static void main(String[] args) {
        String[] arr1 = { "a", "b", "c", "d" };
        String[] arr2 = { "d", "e", "f", "g" };
        Stream<String> stream1 = Stream.of(arr1);
        Stream<String> stream2 = Stream.of(arr2);

        //合并
        Stream.concat(stream1,stream2).forEach(System.out::println);

        //去重--distinct
        Stream.concat(stream1,stream2).distinct().forEach(System.out::println);

        //获取前n个元素--limit
        Stream.concat(stream1,stream2).limit(3).forEach(System.out::println);

        //跳过前n个元素
        Stream.concat(stream1,stream2).skip(3).forEach(System.out::println);
    }
}
